﻿namespace ImageDupFinder
{
    using System.Drawing;
    using ImageDupFinder.PluginCore;

    /// <summary>
    /// Default features collection. Used by deafult (build in) plugin.
    /// </summary>
    public class DefaultFeaturesSet : IFeatureCollection
    {
        /// <summary>
        /// Features used by this plugin.
        /// </summary>
        private readonly string[] featureNames = { HistogramDescriptor.FeatureName, BRIEFDescriptor.FeatureName };

        #region IFeatureCollection Members

        /// <summary>
        /// Gets feature names used by default plugin.
        /// </summary>
        public string[] FeatureList
        {
            get { return featureNames; }
        }

        /// <summary>
        /// Calculates default feature set from provided image.
        /// </summary>
        /// <param name="image">Image used in feature extraction</param>
        /// <returns>Caltulated features</returns>
        public IFeature[] CalculateFeatures(Bitmap image)
        {
            IFeature[] retVal = new IFeature[featureNames.Length];

            HistogramDescriptor hist = new HistogramDescriptor();
            hist.CalculateFeature(image);

            retVal[0] = hist;
            retVal[1] = new BRIEFDescriptor(image);

            return retVal;
        }

        #endregion
    }
}
